package com.gujiangbo.schedule;

import com.gujiangbo.request.BatchGenerateCondition;
import com.gujiangbo.service.SchoolmateService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author: gujiangbo.co
 * @Contact: 646832012@qq.com
 * @Date: 2021/12/10 17:11
 * @Version: 1.0
 * @Description:
 */
@Component
@Configurable
@EnableScheduling
public class SchoolMatesTask implements AbstractActor {

    private static final Log debugLog = LogFactory.getLog(SchoolMatesTask.class);

    @Resource
    private SchoolmateService schoolmateService;


    @Scheduled(cron = "${task.schoolmates.cron}")
    @Override
    public void onReceive() throws Throwable {
        debugLog.info("schoolmates task start..");
        BatchGenerateCondition condition = new BatchGenerateCondition();
        condition.setBatchNo(10);
        schoolmateService.batchGenerateSchoolmates(condition);
        debugLog.info("schoolmates task end...");
    }
}
